<div id="preguntas_pendientes_div_izquierdo" class="span9">

<?php

	// how many records should be displayed on a page?
	$records_per_page = 20;
	
	// include the pagination class
	require '../../zebra-pagination/Zebra_Pagination.php';
	
	// instantiate the pagination object
	$pagination = new Zebra_Pagination();

     $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM preguntas WHERE usuario_id='$_SESSION[usuario_id]' AND respuesta_id<>0 ORDER BY respuesta_id DESC LIMIT " . (($pagination->get_page() - 1) * $records_per_page) . ", " . $records_per_page;
     
     // if query could not be executed
     if (!($result = @mysql_query($sql))) {
     	 
     	// stop execution and display error message
     	die(mysql_error());
     	 
     }
     
     // fetch the total number of records in the table
     $rows = mysql_fetch_assoc(mysql_query('SELECT FOUND_ROWS() AS rows'));
     
     // pass the total number of records to the pagination class
     $pagination->records($rows['rows']);
     
     // records per page
     $pagination->records_per_page($records_per_page);
     
     $result = mysql_query($sql);?>
     <h2 class="right-line"><?php echo gettext("Preguntas Realizadas")?></h2>
     <?php  $encontro = false;
        while ($pregunta = mysql_fetch_array($result)){
             $encontro = true;
             include '../../template/pregunta_respuesta.php';
             echo "<hr>";
        }?>
     
        <div id='paginacion'>
        <?php $pagination->render();?>
        </div>
        <?php if (!$encontro){?>
           <div class='alert alert-error'>
				    	<button type='button' class='close' data-dismiss='alert'>×</button>
				    	<strong><?php echo gettext("No tienes respuestas recibidas hasta el momento")?></strong>
            	</div>
        <?php }?>

</div>